package testHutools.testcloneUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Name : hutools.cloneUtil.WebsocketTest
 * @Description : 描述
 * Created by cyd on 2021-07-01 14:03:18
 */
public class Test {


    @org.junit.Test
    public void test01(){
        List<String> list01 = new ArrayList<>();
        list01.add("1");
        list01.add("2");
        list01.add("3");

        ArrayList<String> list02 = new ArrayList<>(list01);
        System.out.println(list01.equals(list02));
    }

    @org.junit.Test
    public void test02(){
        List<Apple> list01 = new ArrayList<>();
        list01.add(new Apple("1"));
        list01.add(new Apple("2"));
        list01.add(new Apple("3"));

        ArrayList<Apple> list02 = new ArrayList<>(list01);
        System.out.println(list01.equals(list02));

        list02.forEach(apple -> {
            apple.setColor("red");
        });

        System.out.println(list01.equals(list02));
        System.out.println(list01);
    }

    @org.junit.Test
    public void test03(){
        List<Apple> list01 = new ArrayList<>();
        list01.add(new Apple("1"));
        list01.add(new Apple("2"));
        list01.add(new Apple("3"));
        System.out.println(list01);

        List<Apple> list02 = list01.stream().collect(Collectors.toList());


        System.out.println(list01.equals(list02));

        list02.forEach(apple -> {
            String color = apple.getColor();
            color.concat("red");
        });

        System.out.println(list01.equals(list02));
        System.out.println(list01);
    }
}
